4
4
.
.
3
3
.
.
2
2
S
S
p
p
a
a
c
c
e
e
r
r
I
I
n
n
f
f
o
o
Spacer is not Container View, instead it is used to organize children of the Container View.
Spacers are used to add space between Views in HStack and VStack.
Spacers expands to fill all available remaining space.
Multiple Spacers will divide reaming space equally between themselves.
E
E
x
x
a
a
m
m
p
p
l
l
e
e
s
s
Spacers don't have weight property to define which spacer should take more space compared to others.
Instead simply use multiple spacers where more space should be allocated to spacers.
In below example middle part has 2 spacers in order to take twice as much space as side parts.
Code
VStack {
Spacer()
Text("First Line")
Spacer()
Spacer()
Text("Second Line")
Spacer()
}
View